
import requests

# 1.分析请求地址
# url = "http://httpbin.org/get?name=qiku"
# # 2.发起请求
# response = requests.get(url,params={
#     'age':10,
#     'addr':"东三街"
# })
# # 3.解析
#
# if response.status_code == 200:
#     # print(response.content)
#     # print(response.text)
#     print(response.json())


# url = "http://httpbin.org/get?name=qiku"
#
# response = requests.get(url,params={
#     'age':10,
# },headers={
#     'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1',
#
# })
# if response.status_code == 200:
#     # print(response.content)
#     # print(response.text)
#     print(response.json())



url = "http://httpbin.org/post?name=qiku"

response = requests.post(url,headers={
'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1',

},data = {
    'age':10,
    'addr':'地球村',

}  )
if response.status_code == 200:
    print(response.content)
    print(response.text)
    print(response.json())




# url = "http://httpbin.org/post?name=qiku"
#
# response = requests.post(url,headers={
# 'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1',
#
# },json = {
#     'age':10,
#     'addr':'地球村',
# }  )
# if response.status_code == 200:
#     print(response.json())




#
# url = "https://c-ssl.dtstatic.com/uploads/blog/202303/20/20230320145706_07ca5.thumb.400_0.jpeg"
# response = requests.get(url)
# if response.status_code == 200:
#     print(response.content)
#     with open(f"static/test.jpeg", "wb") as f:
#         f.write(response.content)














